$configuration = $args[2]
$server = $args[0]
$zip = $args[1]

$msbuild = "C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"
[Array]$options = "/p:Configuration=$configuration", "/p:DeployOnBuild=true", "/t:rebuild";
$solution = "..\WebTasks.sln" 
& $msbuild $solution $options;
Write-Host "Build End..."
Read-Host -Prompt "Press any key to continue..."

Write-Host "Deploy Start..."
$exe = "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe"
[Array]$params = "-verb:sync", "-source:package=$zip", "-dest:auto,computername=$server", "-setParamFile:config.SetParameters.xml";
& $exe $params;
Write-Host $exe $params;
Write-Host "Deploy End..."
Read-Host -Prompt "Press any key to continue..."

Write-Host "Copy Start..."
$from = "\\"+$server+"\c$\Inetpub\wwwroot\wss\VirtualDirectories\80\WebTasks\*"
$to =  "\\"+$server+"\c$\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\WebTasks"
copy-item $from $to -Recurse -ErrorAction SilentlyContinue
$from = "\\"+$server+"\c$\Inetpub\wwwroot\wss\VirtualDirectories\80\WebTasks\App_Themes\*"
$to = "\\"+$server+"\c$\Inetpub\wwwroot\wss\VirtualDirectories\80\App_Themes"
copy-item $from $to -Recurse -ErrorAction SilentlyContinue
$from = "\\"+$server+"\c$\Inetpub\wwwroot\wss\VirtualDirectories\80\WebTasks\bin\*"
$to = "\\"+$server+"\c$\Inetpub\wwwroot\wss\VirtualDirectories\80\bin"
copy-item $from $to -Recurse -ErrorAction SilentlyContinue
Write-Host "Copy End..."
Read-Host -Prompt "Press any key to continue..."

